var si = require('systeminformation');


// si.currentLoad(function (data) { 
//     console.log(data);
// });

setInterval(() => {
    console.log("==========");
    si.currentLoad(function (data) {
        var cpuData = data.cpus.map((cpu, i) => {
            return {
                title: 'CPU' + (i + 1),
                // x: Array(61).fill().map((_, i) => 60 - i),
                // y: Array(61).fill(0)
            }
        });
        // console.log(cpuData);
        data.cpus.forEach((cpu, i) => {
            var loadString = cpu.load.toFixed(1).toString();
            while (loadString.length < 6) {
                loadString = ' ' + loadString;
            }
            loadString = loadString + '\%';

            cpuData[i].title = 'CPU' + (i + 1) + loadString;
            //    cpuData[i].y.shift();
            //    cpuData[i].y.push(cpu.load);
            console.log(cpuData[i].title);
        })
    });

}, 1000);